<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('根证书管理')" />
	<th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="gray-bg">
	<div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="operlog-form">
					<div class="select-list">
						<ul>
							<li>
								<label>系统模块： </label><input type="text" name="title"/>
							</li>
							<li>
								<label>操作人员： </label><input type="text" name="operName"/>
							</li>
							
							<li class="select-time">
								<label>操作时间： </label>
								<input type="text" class="time-input" id="startTime" placeholder="开始时间"/>
								<span>-</span>
								<input type="text" class="time-input" id="endTime" placeholder="结束时间"/>
							</li>
							<li>
								 <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
			<div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="monitor:operlog:remove">
		            <i class="fa fa-remove"></i> 删除
		        </a>
		        <a class="btn btn-danger" onclick="$.operate.clean()" shiro:hasPermission="monitor:operlog:remove">
	                <i class="fa fa-trash"></i> 清空
	            </a>
	            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="monitor:operlog:export">
		            <i class="fa fa-download"></i> 导出
		        </a>
	        </div>
	        
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table"></table>
			</div>
		</div>
	</div>
	
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: bootstrap-select-js" />
	<script th:inline="javascript">
	
		
		var prefix = ctx + "ca";

		$(function() {
		    var options = {
		        url: prefix + "/subRootCertList",
		        sortName: " a.id",
		        sortOrder: " asc",
		        modalName: "子根证书管理",
		        escape: true,
		        showPageGo: true,
		        rememberSelected: true,
		        columns: [
		        {
		            field: 'certName',
		            title: '证书名称'
		        },
		        {
		            field: 'serialNumber',
		            title: '序列号'
                },
		        {
		            field: 'publicKeySize',
		            title: '公钥长度'
		        },
		        {
		            field: 'signAlgorithm',
		            title: '签名算法'
		        },
		        {
		            field: 'notAfter',
		            title: '过期时间'
		        },
		        {
		            field: 'status',
		            title: '状态',
		            formatter: function(value, row, index) {
		                if (value == 'NORMAL') {
		                    return '正常';
		                } else if (value == 'REVOKE') {
		                    return '吊销';
		                }else if(value == 'EXPIRE'){
		                	return '过期';
		                }
		            }
		        },
		        {
		            field: 'createDate',
		            title: '创建时间'
		        },
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		                var actions = [];
		                actions.push('<a class="btn btn-warning btn-xs " href="javascript:void(0)" onclick="getSignCert(\'' + row.id + '\')"><i class="fa fa-download"></i>下载证书</a>');
		                actions.push(' <a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="subCert(\'' + row.id + '\')"><i class="fa "></i>子证书</a>');
			               
		                return actions.join('');
		            }
		        }]
		    };
		    $.table.init(options);
		});
		
		
		
		function getSignCert(id) {
		   window.location.href=prefix+"/getSignCert?id="+id;
		}
		
		
	</script>
</body>
</html>